//我的页面
import 'package:flutter/material.dart';
import 'package:test_xzkdemo/utils/common/global.dart';

//列表页面示例
class MinePage extends StatefulWidget {
  MinePage({Key key, String title}) : super(key: key);

  @override
  _MinePageState createState() => new _MinePageState();
}

class _MinePageState extends State<MinePage> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: Container(
        width: G.screenWidth(context),
        child: _buildHeader(),
      ),
    );
  }

//创建标题头
  Widget _buildHeader() {
    return Container(
      width: G.screenWidth(context),
      height: 150,
      //学习设置背景颜色形状等
      decoration: ShapeDecoration(
        color: Colors.blue,
        shape: new BeveledRectangleBorder(
          borderRadius: BorderRadius.zero,
          side: new BorderSide(
            style: BorderStyle.solid,
            color: Colors.blue,
          ),
        ),
      ),
      child: Center(
        child: Column(
          children: <Widget>[
            Container(
              margin: EdgeInsets.only(top: 40),
              decoration: new BoxDecoration(
                color: Colors.white,
                // 这里设置
                borderRadius: new BorderRadius.all(
                  const Radius.circular(30.0),
                ),
              ),
              child: ClipOval(
                child: GestureDetector(
                  onTap: () => _clickUserInfo(),
                  child: Image.network(
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2008531081,2093585221&fm=11&gp=0.jpg',
                    width: 60,
                    height: 60,
                    fit: BoxFit.cover,
                  ),
                ),
              ),
            ),
            Container(
              margin: EdgeInsets.only(top: 6),
              child: GestureDetector(
                onTap: () => _clickUserInfo(),
                child: Text(
                  "名字",
                  style: TextStyle(
                    color: Colors.white,
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
//点击头像，进入个人详情
  void _clickUserInfo() {
    Navigator.of(context).pushNamed("/userinfo");

  }
}
